//
//  AppDelegate.swift
//  customNavigationBarBackButton
//
//  Created by 李煜 on 2024/1/18.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        return true
    }
}

extension UIViewController {
    func screen() -> UIScreen? {
        var parent = self.parent
        var lastParent = parent
        while parent != nil {
            lastParent = parent
            parent = parent?.parent
        }
        if #available(iOS 13.0, *) {
            return lastParent?.view.window?.windowScene?.screen
        } else {
            return nil
        }
    }
}
